<template>
  <div class="paySuccess">
    
			<h2>支付成功 {{amount}}</h2>

  </div>
</template>

<script>
// @ is an alias to /src
export default {
  created(){
    this.example_for_created()
  },
  data(){
      return {
		// 不能带有空格缩进，会报错
        amount: ''
      }
  },
  methods: {
    // 支付宝回调时会在地址栏上携带参数，使用以下方式取出它们
    example_for_created(){
        // http://192.168.0.1:8080/paySuccess?id=2&name=wang
        var url_params = window.location.search.split("?")[1]
        // => id=2&name=wang
		const id = url_params.split("=")[1].split("&")[0]
        // => 2
		const name = url_params.split("=")[2].split("&")[0]
        // => wang
		console.log(id, name)
		// arrays
		var search = window.location.search.split("?")[1].split('&');
        var row = [];
        for(var i in search){
            row = search[i].split('=');
            console.log(row[0] + ':' + row[1])
            row[0]==='total_amount'&&(this.amount=row[1])
        }
    }
  },
  components: {
  }
}
</script>

